/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 25228
 * Date: 2024-08-14
 * Time: 19:09
 */
class Solution2 {
    List<Integer> list = new ArrayList<>();
    public List<Integer> inorderTraversal(TreeNode root) {
        inorderTraversal2(root);
        return list;
    }
    public void inorderTraversal2(TreeNode root){
        if(root==null){
            return;
        }
        inorderTraversal2(root.left);
        list.add(root.val);
        inorderTraversal2(root.right);
    }
}
